import 'package:test/models/core/model.dart';
import 'package:test/entities/article.dart';

class ArticleModel extends Model {
  @override
  String get tableName => 'article';

  /// 查询所有数据(按创建时间降序)
  Future<List<Article>> queryItemsOrderByCreateTime() async {
    List<Map<String, Object?>> items = await queryItems(
      orderBy: 'create_time desc'
    );
    return items.map((e) => Article.fromJson(e)).toList();
  }
}